#include<iostream>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int n, m;
int arr[N];
long long tree1[N], tree2[N];

int lowbit(int x)
{
	return x & -x;
}

void add(LL tree[], int x, int c)
{
	for (int i = x; i <= n; i += lowbit(i)) {
		tree[i] += c;
	}
}

LL query(LL tree[], int x)
{
	LL res = 0;
	for (int i = x; i; i -= lowbit(i)) {
		res += tree[i];
	}
	return res;
}

LL get_sum(int x)
{
	return query(tree1, x) * (x + 1) - query(tree2, x);
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
		int d = arr[i] - arr[i - 1];
		add(tree1, i, d);
		add(tree2, i, i * d);
	}
	while (m--) {
		char op[2];
		cin >> op;
		if (op[0] == 'C') {
			int l, r, d;
			cin >> l >> r >> d;
			add(tree1, l, d);
			add(tree2, l, l * d);
			add(tree1, r + 1, -d);
			add(tree2, r + 1, (r + 1) * (-d));
		}
		else {
			int  l, r;
			cin >> l >> r;
			cout << get_sum(r) - get_sum(l - 1) << endl;
		}
	}
	return 0;
}